<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue第四次</title>
</head>

<body>

    <div id="app">
        <!-- <button v-bind:disabled="model">符合规定是</button> -->

        {{msg}}次

        <input type="button" v-on:click="btnClink" value="点击">

        <a v-bind:[models]="url">超链接</a>

        <label for="">{{age}}</label>

        <!-- <button v-on:mouseover="overColor" v-on:mouseout="outColor" v-bind:style="color">点击</button> -->
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
    <script>
        let app = new Vue({
            el: '#app',
            data: {
                url: 'http://baidu.com',
                msg: 0,
                "models": 'href',
                parmArr: ['href', 'http', 'com', 'net', 'top'],
                // model:false
                green: {
                    id: 1,
                    name: 'ddd',
                    birth: 222
                }
            },
            methods: {
                btnClink: function () {
                    let rnd = Math.floor(Math.random() * this.parmArr.length);
                    console.log(rnd);
                    this.msg += 1
                    this.models = this.parmArr[rnd]
                }
            },
            computed: {
                age: function () {
                    return 2021 - this.green.birth
                }
            },
            watch: {
                'green.birth': function (newVal) {
                    console.log(newVal);
                },
                nickname: function (val) {
                    console.log(val);
                }
            }
        })
    </script>

   
</body>

</html>